#include<iostream>
using namespace std;
typedef long long LL;
const int N = 55;
int n;
int arr[N];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		LL ans = 1;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> arr[i];
			ans *= arr[i];
		}
		ans = ans + n - 1;
		ans *= 2022;
		cout << ans << endl;
	}
	return 0;
}